package com.zr.controller;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.zr.service.HostelSelectService;

/**
 * 更新寝室操作
 * @author wxz
 *
 */
public class GetHostelUpdateController extends HttpServlet{
	HostelSelectService hss = new HostelSelectService();
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		doPost(req, resp);
	}
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		req.setCharacterEncoding("utf8");
		int hid=Integer.parseInt(req.getParameter("hid"));
		int sid=Integer.parseInt(req.getParameter("sid"));
		String sname=req.getParameter("sname");
		boolean flag=hss.getSelectHostelUpdate(sid, sname, hid);
		resp.setCharacterEncoding("utf8");
		PrintWriter pw=resp.getWriter();
		if(flag){
			pw.write("添加成功");
		}
	}
}
